﻿using System;
using Autofac;

namespace Zinnia.Lite.Services
{
    /// <summary>
    /// 服务接口
    /// </summary>
    public interface IServiceHub
    {
        /// <summary>
        /// 初始化
        /// </summary>
        void Initialize();
        /// <summary>
        /// 获取指定依赖类型对象
        /// </summary>
        /// <typeparam name="T">依赖类型</typeparam>
        /// <param name="key">类型标识</param>
        /// <param name="lifetimeScope">注入容器作用域</param>
        /// <returns></returns>
        T Resolve<T>(string key = "", ILifetimeScope lifetimeScope = null) where T : class;

        /// <summary>
        ///  获取依赖类型对象
        /// </summary>
        /// <param name="type">依赖类型</param>
        /// <returns></returns>
        object Resolve(Type type);

        /// <summary>
        ///获取指定依赖类型所有实现
        /// </summary>
        /// <typeparam name="T">依赖类型</typeparam>
        /// <returns></returns>
        T[] ResolveAll<T>();
    }
}
